package com.cloudeggtech.granite.chat;

import android.content.Context;
import android.os.Environment;

import java.io.IOException;
import java.util.Properties;

/**
 * Created by david on 15/11/3.
 */
public class AppProperties {

    private static Properties properties = new Properties();
    private static final String APP_PROPERTIES_FILE = "app.properties";

    public static void initialize(Context context) {
        try {
            properties.load(context.getAssets().open(APP_PROPERTIES_FILE));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public static class CONFIG {
        public static final String XMPP_SERVER = properties.getProperty("xmpp_server");
        public static final Integer XMPP_PORT = Integer.parseInt(properties.getProperty("xmpp_port"));

        /**
         * 本地文件存放路径
         */
        public static String LOCAL_PATH = Environment.getExternalStorageDirectory().getAbsolutePath() + "/com.cloudeggtech.cubicle/data/";
        /**
         * 本地图片缓存路径
         */
        public static String LOCAL_PATH_IMAGE = LOCAL_PATH + "images/";

        public static String get(String key) {
            return properties.getProperty(key);
        }
    }

    public static class URL {

    }
}
